import datetime

from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User

# Create your models here.

class BaseSensitiveInfo(models.Model):
    录入时间 = models.DateTimeField(default=datetime.datetime.now,null=True,blank=True)
    维护人 = models.ForeignKey(User,on_delete=models.CASCADE, related_name="data_posts")
    数据库 = models.CharField(max_length=200)
    数据表 = models.CharField(max_length=300)
    列名 = models.CharField(max_length=200)
    列名称 = models.CharField(max_length=200,null=True,blank=True)
    备注 = models.CharField(max_length=300,null=True,blank=True)
    是否收录蓝鲸 = models.BooleanField(null=True,blank=True)
    数据分类 = models.CharField(max_length=100,null=True,blank=True)
    sensitive_choice = ((1,'L1'),(2,'L2'),(3,'L3'),(4,'L4'))
    数据分级 = models.IntegerField(choices=sensitive_choice)

    class Meta:
        verbose_name = '元数据管理'
        verbose_name_plural = '元数据管理'
        ordering = ("数据库","数据表")

    def __str__(self):
        return self.数据库

class Metadata(models.Model):
    datetime = models.CharField(max_length=200)
    id = models.CharField(primary_key=True,max_length=100)
    database_name = models.CharField(max_length=200)
    table_name = models.CharField(max_length=200)
    column_name = models.CharField(max_length=200)
    simpling01 = models.CharField(max_length=200)
    classify = models.CharField(max_length=100)